//
//  TranslationShowTimeView.swift
//  GLUZSwift
//
//  Created by xyanl on 2025/3/24.
//  Copyright © 2025 考拉🐨. All rights reserved.
//
//  翻译 显示时间
import UIKit
import Localize_Swift
import Reusable

extension TranslationShowTimeView: NibLoadable {}

class TranslationShowTimeView: UIView {

    @IBOutlet weak var timeTitleLabel: UILabel!
    @IBOutlet weak var timeLabel: UILabel!
    
    @IBOutlet weak var closeView: UIView!
    @IBOutlet weak var closeTitleLabel: UILabel!
    
    var removeBlock: (() -> Void)?
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        addRoundedCorners(radius: 10)
        closeView.addRoundedCorners(radius: 14)
        closeView.sg.addTapGesture(self, #selector(removeAction))
        
        timeLabel.font = .monospacedSystemFont(ofSize: 12, weight: .regular)
        
        /// 监听语言的变化
        NotificationCenter.default.addObserver(self, selector: #selector(updateLanguageAction), name: NSNotification.Name(LCLLanguageChangeNotification), object: nil)
        updateLanguageAction()
    }
    
    // 更新语言
    @objc private func updateLanguageAction() {
        timeTitleLabel.text = "服务时长".localized(.call) + "："
        closeTitleLabel.text = "移除人工翻译".localized(.call)
        
    }
    
    @objc private func removeAction() {
        removeBlock?()
    }
    
}
